<?php

use yii\helpers\Html;
use yii\widgets\DetailView;


$this->title = '供应商详情';
$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Suppliers'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="supplier-view">

     <div class="box">
        <div class="box-header">
        <?= Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
        </div>
        <div class="box-body">

            <?= DetailView::widget([
                'model' => $model,
                'attributes' => [
                    [
                        'attribute' => 'type',
                        'filter' =>  Yii::$app->params['supplier_type'],
                        'value' => function ($model) {
                                return isset(Yii::$app->params['supplier_type'][$model->type])?Yii::$app->params['supplier_type'][$model->type]:'';
                            },
                    ],
                    'en_name',
                    [
                        'label'=>'酒店品牌',
                        'format'=>'raw',
                        'value' => function($model){
                            $str = $model->brand;
                            return $str;
                        }
                    ],
                    'person',
                    'phone',
                    'address',
                    [
                        'attribute' => 'city',
                        'value' => function ($model) {

                                return isset($model->cityName) ? $model->cityName->code.'——'.$model->cityName->en_name.'——'.$model->cityName->zh_name : '';
                            },
                    ],
                    'email:email',
                    [
                        'attribute' => 'url',
                        'format'=>'raw',
                        'value' => function($model) { 
                            return Html::a(Html::encode($model->url), Html::encode($model->url),['target'=>'_blank']);
                        } 
                    ],
                    'remark',
                    [
                      'attribute' => 'user_id',
                      'value' => function($model){

                            return isset($model->user) ? $model->user->name : '管理员';
                      }
                    ],
                ],
            ]) ?>

        </div>
        
    </div>    

</div>
